package com.xmu.prcs.entity;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Index;
/**
 * 特征表
 * @author frequent
 *
 */
/*
 * 2012-3-24 增加了isNumber frequent
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "feature")
@org.hibernate.annotations.Table(appliesTo = "feature",
        indexes = {@Index(name = "idxFINFO", columnNames = {"featureinfo"})})
public class Feature implements Serializable {

	private Integer idFeature;
	private String featureInfo;//特征
	private Integer isNumer;//是否是数值型
	private Integer isDay;//是否是日期型
	private Integer defaultGrade;//默认的形状重要性
	private Part part;//所属的小部位
	private Set<Feature> child;//子特征，小部分可能有四级、五级特征
	
	public Feature(){
		
	}
	
	public Feature(String info){
		this.featureInfo = info;

	}

	@Id
	@GeneratedValue
	@Column(name = "idfeature", unique = true, nullable = true)
	public Integer getIdFeature() {
		return idFeature;
	}

	public void setIdFeature(Integer idFeature) {
		this.idFeature = idFeature;
	}

	@Column(name = "featureinfo", length = 20)
	public String getFeatureInfo() {
		return featureInfo;
	}

	public void setFeatureInfo(String featureInfo) {
		this.featureInfo = featureInfo;
	}
	
	@Column(name = "isnumber")
	public Integer getIsNumer() {
		return isNumer;
	}

	public void setIsNumer(Integer isNumer) {
		this.isNumer = isNumer;
	}

	@Column(name = "isday")
	public Integer getIsDay() {
		return isDay;
	}

	public void setIsDay(Integer isDay) {
		this.isDay = isDay;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idpart", nullable = true)
	public Part getPart() {
		return part;
	}

	public void setPart(Part part) {
		this.part = part;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumn(name = "idfather")
	public Set<Feature> getChild() {
		return child;
	}

	public void setChild(Set<Feature> child) {
		this.child = child;
	}

	@Column(name = "defaultgrade")
	public Integer getDefaultGrade() {
		return defaultGrade;
	}

	public void setDefaultGrade(Integer defaultGrade) {
		this.defaultGrade = defaultGrade;
	}
	
}
